/*
 * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "imx35-eukrea-cpuimx35.dtsi"

/ {
	model = "Eukrea CPUIMX35";
	compatible = "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35";

	gpio_keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_bp1>;

		bp1 {
			label = "BP1";
			gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
			linux,code = <BTN_MISC>;
			wakeup-source;
			linux,input-type = <1>;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led1>;

		led1 {
			label = "led1";
			gpios = <&gpio3 29 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
		};
	};

	sound {
		compatible = "eukrea,asoc-tlv320";
		eukrea,model = "imx35-eukrea-tlv320aic23";
		ssi-controller = <&ssi1>;
		fsl,mux-int-port = <1>;
		fsl,mux-ext-port = <4>;
	};
};

&audmux {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_audmux>;
	status = "okay";
};

&esdhc1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_esdhc1>;
	cd-gpios = <&gpio3 24 GPIO_ACTIVE_LOW>;
	status = "okay";
};

&i2c1 {
	tlv320aic23: codec@1a {
		compatible = "ti,tlv320aic23";
		reg = <0x1a>;
	};
};

&iomuxc {
	imx35-eukrea {
		pinctrl_audmux: audmuxgrp {
			fsl,pins = <
				MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS	0x80000000
				MX35_PAD_STXD4__AUDMUX_AUD4_TXD		0x80000000
				MX35_PAD_SRXD4__AUDMUX_AUD4_RXD		0x80000000
				MX35_PAD_SCK4__AUDMUX_AUD4_TXC		0x80000000
			>;
		};

		pinctrl_bp1: bp1grp {
			fsl,pins = <MX35_PAD_LD19__GPIO3_25  0x80000000>;
		};

		pinctrl_esdhc1: esdhc1grp {
			fsl,pins = <
				MX35_PAD_SD1_CMD__ESDHC1_CMD		0x80000000
				MX35_PAD_SD1_CLK__ESDHC1_CLK		0x80000000
				MX35_PAD_SD1_DATA0__ESDHC1_DAT0		0x80000000
				MX35_PAD_SD1_DATA1__ESDHC1_DAT1		0x80000000
				MX35_PAD_SD1_DATA2__ESDHC1_DAT2		0x80000000
				MX35_PAD_SD1_DATA3__ESDHC1_DAT3		0x80000000
				MX35_PAD_LD18__GPIO3_24			0x80000000 /* CD */
			>;
		};

		pinctrl_led1: led1grp {
			fsl,pins = <MX35_PAD_LD23__GPIO3_29  0x80000000>;
		};

		pinctrl_reg_lcd_3v3: reg-lcd-3v3 {
			fsl,pins = <MX35_PAD_D3_CLS__GPIO1_4 0x80000000>;
		};

		pinctrl_uart1: uart1grp {
			fsl,pins = <
				MX35_PAD_TXD1__UART1_TXD_MUX		0x1c5
				MX35_PAD_RXD1__UART1_RXD_MUX		0x1c5
				MX35_PAD_CTS1__UART1_CTS		0x1c5
				MX35_PAD_RTS1__UART1_RTS		0x1c5
			>;
		};

		pinctrl_uart2: uart2grp {
			fsl,pins = <
				MX35_PAD_RXD2__UART2_RXD_MUX		0x1c5
				MX35_PAD_TXD2__UART2_TXD_MUX		0x1c5
				MX35_PAD_RTS2__UART2_RTS		0x1c5
				MX35_PAD_CTS2__UART2_CTS		0x1c5
			>;
		};
	};
};

&ssi1 {
	codec-handle = <&tlv320aic23>;
	status = "okay";
};

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart1>;
	uart-has-rtscts;
	status = "okay";
};

&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart2>;
	uart-has-rtscts;
	status = "okay";
};

&usbhost1 {
	phy_type = "serial";
	dr_mode = "host";
	status = "okay";
};

&usbotg {
	phy_type = "utmi";
	dr_mode = "otg";
	external-vbus-divider;
	status = "okay";
};
